<template>
  <div class="header_img">
    <NuxtImg src="/images/activity/daily-checkin/img-01.png" alt="" />
  </div>
  <div class="header_box">
    <div class="header_box_one">
      <div class="text">
        {{ lang.remaining_text_1 }} <span>{{ userStore.moneyUnit }}24.64</span>
        {{ lang.remaining_text_2 }} {{ userStore.moneyUnit }}30
      </div>
      <div class="btn_box">
        <div class="coin">
          <NuxtImg src="/images/activity/daily-checkin/icon-coin1.png" alt="" />
          {{ pegar }}
        </div>
        <div class="btn">{{ lang.get_btn }}</div>
      </div>
    </div>
    <div data-v-d4de1adc="" class="header_box_two">
      <div data-v-d4de1adc="" class="progress">
        <div data-v-d4de1adc="" class="progress-bar">
          <div
            class="progress-fill"
            :style="{ width: `${(pegar / total) * 100}%` }"
          ></div>
        </div>
        <div class="progress-marks">
          <div
            v-for="(mark, index) in progressMarks"
            :key="index"
            class="progress-mark"
            :style="{ left: `${mark.percentage}%` }"
          >
            <span class="mark-label">
              <span>
                <NuxtImg
                  v-if="pegar >= mark.value"
                  :src="mark.iconSrc"
                  alt=""
                />
              </span>
              <NuxtImg :src="mark.iconSrc" alt="" />
              {{ mark.value }}
            </span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
const lang: any = getCurrentPageLang("activity/daily-checkin");
const userStore = useUserStore();

const pegar = ref(112);
const total = ref(500);

const progressMarks = ref([
  {
    value: 30,
    percentage: 6,
    iconSrc: "/images/activity/daily-checkin/icon-coin2.png",
  },
  {
    value: 100,
    percentage: 20,
    iconSrc: "/images/activity/daily-checkin/icon-coin2.png",
  },
  {
    value: 250,
    percentage: 50,
    iconSrc: "/images/activity/daily-checkin/icon-coin2.png",
  },
  {
    value: 350,
    percentage: 70,
    iconSrc: "/images/activity/daily-checkin/icon-coin2.png",
  },
  {
    value: 500,
    percentage: 100,
    iconSrc: "/images/activity/daily-checkin/icon-coin2.png",
  },
]);
</script>

<style scoped lang="scss">
.header_img {
  width: 100%;
  height: 4rem;
  margin-top: 1.2rem;

  img {
    width: 100%;
    height: 100%;
  }
}
.header_box {
  margin-top: -0.7rem;
  height: 2.2rem;
  background: fixed;
  background: linear-gradient(
    90deg,
    var(--theme-ts2-gradient1) 0%,
    var(--theme-ts2-gradient2) 100%
  );
  border-radius: 0.3rem 0.3rem 0 0;
  padding: 0.2rem 0.3rem 0.35rem 0.45rem;
  position: relative;
  color: #fff;
  .header_box_one {
    width: 100%;
    height: 0.7rem;
    font-size: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;

    span {
      color: var(--theme-dec4);
    }

    .btn_box {
      height: 100%;
      background: var(--theme-color9);
      border-radius: 0.46rem;
      border: 0.03rem solid var(--theme-color7);
      padding: 0.05rem 0.05rem 0.05rem 0.15rem;
      display: flex;
      align-items: center;

      .coin {
        margin-right: 0.35rem;
        font-size: 0.38rem;
        color: var(--theme-dec4);
        font-weight: 800;
        display: flex;
        align-items: center;

        img {
          width: 0.45rem;
          margin-right: 0.1rem;
          vertical-align: middle;
        }
      }

      .btn {
        height: 100%;
        background: var(--theme-neutral2);
        border-radius: 0.48rem;
        padding: 0 0.25rem;
        display: flex;
        align-items: center;
        justify-content: center;
      }
    }
  }
  .header_box_two {
    margin-top: 0.2rem;

    .progress {
      position: relative;
      width: 100%;
      padding-right: 0.3rem;

      .progress-bar {
        width: 100%;
        height: 0.2rem;
        background-color: var(--theme-color3);
        border-radius: 0.2rem;
        overflow: hidden;

        .progress-fill {
          height: 100%;
          background: linear-gradient(
            360deg,
            var(--theme-main-gradient2) 0%,
            var(--theme-main-gradient1) 81%
          );
          transition: width 0.3s ease;
          border-radius: 0.2rem;
        }
      }

      .progress-marks {
        position: relative;
        width: 100%;
        margin-top: 0.215rem;
        height: 0.3rem;

        .progress-mark {
          position: absolute;
          height: 100%;
          top: 0;
          transform: translate(-50%);
          text-align: center;

          .mark-label {
            height: 100%;
            display: block;
            font-size: 0.3rem;
            display: flex;
            align-items: center;
            position: relative;
            span {
              width: 0.36rem;
              height: 0.36rem;
              background: var(--theme-color3);
              border-radius: 0.49rem;
              border: 0.02rem solid var(--theme-color8);
              position: absolute;
              top: -0.5rem;
              right: 50%;
            }
            img {
              width: 0.35rem;
              height: 0.35rem;
              margin-right: 0.05rem;
            }
          }
        }
      }
    }
  }
}
</style>
